var PORT_TYPE = 'store'
// var SERVER_URL = "http://conclient.jue.so"
var SERVER_URL = "http://192.168.5.16:8100"

var FILE = {
    serviceDescription: '/file/serviceDescription.json'
}

var LOGIN = {
    wechatLogin: "/login/wechatLogin",
    registAndLogin: "/login/registAndLogin",
    getCode: "/login/getCode",
    getMobile: "/login/getMobile",
    test: "/login/test"
}

var CLAIMS = {
    getClaimVehicle: "/claims/getClaimVehicle",
    subscribe: "/claims/subscribe",
    get: "/claims/get",
    getList: "/claims/getList",
    getTire: "/claims/getTire",
    add: "/claims/add",
    edit: "/claims/edit",
}

var EXTENDED_WARRANTY = {
    getCanDo: '/extendedWarranty/getCanDo',
    act: '/extendedWarranty/act',
    getDetail: '/extendedWarranty/getDetail'
}

var UPLOAD = {
    file: '/upload/file'
}

var USER = {
    bindDriverLisence: '/user/bindDriverLisence',
    getInfo: '/user/getInfo',
    bindMobile: '/user/bindMobile'
}

var VEHICLE = {
    add: '/vehicle/add',
    get: '/vehicle/get'
}

var OCR = {
    vehicleLisence: '/ocr/vehicleLisence',
    drivingLisence: '/ocr/drivingLisence'
}

function makeUrl(apiUrl) {
    return SERVER_URL + apiUrl
}

module.exports = {
    portType: PORT_TYPE,
    serverUrl: SERVER_URL,
    makeUrl: makeUrl,
    file: {
        serviceDescription: makeUrl(FILE.serviceDescription)
    },
    login: {
        wechatLogin: makeUrl(LOGIN.wechatLogin),
        registAndLogin: makeUrl(LOGIN.registAndLogin),
        getCode: makeUrl(LOGIN.getCode),
        getMobile: makeUrl(LOGIN.getMobile),
        test: makeUrl(LOGIN.test)
    },
    claims: {
        getClaimVehicle: makeUrl(CLAIMS.getClaimVehicle),
        subscribe: makeUrl(CLAIMS.subscribe),
        get: makeUrl(CLAIMS.get),
        getList: makeUrl(CLAIMS.getList),
        getTire: makeUrl(CLAIMS.getTire),
        add: makeUrl(CLAIMS.add),
        edit: makeUrl(CLAIMS.edit),
    },
    extendedWarranty: {
        getCanDo: makeUrl(EXTENDED_WARRANTY.getCanDo),
        act: makeUrl(EXTENDED_WARRANTY.act),
        getDetail: makeUrl(EXTENDED_WARRANTY.getDetail)
    },
    upload: {
        file: makeUrl(UPLOAD.file)
    },
    user: {
        getInfo: makeUrl(USER.getInfo),
        bindDriverLisence: makeUrl(USER.bindDriverLisence),
        bindMobile: makeUrl(USER.bindMobile)
    },
    vehicle: {
        add: makeUrl(VEHICLE.add),
        get: makeUrl(VEHICLE.get)
    },
    ocr: {
        vehicleLisence: makeUrl(OCR.vehicleLisence),
        drivingLisence: makeUrl(OCR.drivingLisence)
    }
}